// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently

#pragma once

#ifndef STRICT
#define STRICT
#endif

#include "targetver.h"

#define _ATL_APARTMENT_THREADED

#define _ATL_NO_AUTOMATIC_NAMESPACE

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS	// some CString constructors will be explicit


#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW

#include "resource.h"
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
#include <atlcomcli.h>
using namespace ATL;

#include <msdbg.h> 
#include <dbgmetric.h> 

#include "ComEnumWithCount.h"

#define WM_CONTINUE_SYNC_EVENT      (WM_USER + 100)
#define WM_BREAKPOINT               (WM_USER + 101)
#define WM_CANSTOP                  (WM_USER + 102)
#define WM_SINGLESTEP               (WM_USER + 103)
#define WM_OUTDBG_MESSAGE           (WM_USER + 104)
#define WM_EXPR_EVAL                (WM_USER + 105)
#define WM_PROGRAM_ENDED            (WM_USER + 106)

#define IMPLEMENT_CREATE(cls, x) \
    static HRESULT Create( x **ppOut ) { \
    HRESULT hr; \
    CComObject< cls > *p; \
    if( SUCCEEDED( hr = CComObject< cls >::CreateInstance( &p ) ) ) { \
    p->AddRef(); \
    hr = p->QueryInterface( IID_ ## x, (void**)ppOut ); \
    p->Release(); \
    } \
    return hr; \
}

#define XORT_LANG_NAME "xort"

// XORT language GUID
extern const GUID __declspec(selectany) // ABE58BB6-4F58-11E2-A310-E2226188709B
    IID_IXortLanguage = { 0xABE58BB6, 0x4F58, 0x11E2, { 0xA3, 0x10, 0xE2, 0x22, 0x61, 0x88, 0x70, 0x9B } };

class CAutoLock
{
    CComCriticalSection *m_pSec;
public:
    CAutoLock( CComCriticalSection *pSec ) { m_pSec = pSec; m_pSec->Lock(); }
    ~CAutoLock() { m_pSec->Unlock(); }
};

int ParseCmdLine( CHAR *cmdstart , int *piArgc, char ***ppArgv );

/*
free guids:
53B976D2-4F58-11E2-9C2F-45226188709B
5766EFEE-4F58-11E2-B6E6-46226188709B
5BE15B7C-4F58-11E2-B351-47226188709B
61083F12-4F58-11E2-8593-4B226188709B
67EB1F5C-4F58-11E2-869C-58226188709B
6BA7D69E-4F58-11E2-AD5A-59226188709B
6F687C16-4F58-11E2-8325-5D226188709B
7AFCE490-4F58-11E2-97B8-5E226188709B
82A17D3C-4F58-11E2-AEE8-62226188709B
86D82126-4F58-11E2-8FF1-B0226188709B
8B033C72-4F58-11E2-8DD9-B1226188709B
9032DDC4-4F58-11E2-9551-B2226188709B
93A3BEE2-4F58-11E2-AAB9-B8226188709B
9766AB3E-4F58-11E2-9305-B9226188709B
9B21878A-4F58-11E2-8DB5-BA226188709B
9F793620-4F58-11E2-A6A9-BC226188709B
A371AD02-4F58-11E2-83A0-BD226188709B
A6C93448-4F58-11E2-A2AA-C1226188709B
AFB543EE-4F58-11E2-A30E-E9226188709B
*/

#define SAFE_RELEASE(x) if(x){x->Release();x=NULL;}
#define SAFE_FREESTR(x) if(x){SysFreeString(x);x=NULL;}

#include "XortDebugEngine_i.h"